/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { HttpSrv } from 'lfun-bg-comp';
import { PageParams, PageResult, Result } from '..';

export interface Transaction {
  transaction_type?: string;
  transaction_remark?: string;
  original_position?: string;
  current_position?: string;
  position_date?: string;
  operator_name?: string;
  transaction_time?: string;
  teacher_id?: any;
  process_id?: any;
  retire_number?: number;
}
export interface SearchTransactionParams {
  teacher_name?: string;
  teacher_number?: string;
  teacher_id_type?: string;
  teacher_id_number?: string;
  teacher_gender?: string;
  transaction_time?: string;
  transaction_type?: string;
  teacher_district?: string;
  school_id?: any;
}

export const createTransaction = (params: Transaction): Result<Transaction> =>
  HttpSrv().post('/school/v1/teacher-transaction/teacher-transaction', params);

export const createRetire = (params: Transaction): Result<Transaction> =>
  HttpSrv().post('/school/v1/teacher-transaction/teacher-retire', params);

export const searchTransaction = (params: SearchTransactionParams & PageParams): Result<PageResult<Transaction>> =>
  HttpSrv().get('/school/v1/teacher-transaction/transaction', { params });

export const getTransactionByTeacher = (teacher_id: any): Result<Array<Transaction>> =>
  HttpSrv().get('/school/v1/teacher-transaction/teacher-transaction-all', { params: { teacher_id } });

export const transactionRevoked = (teacher_id: any): Result<PageResult<Transaction>> =>
  HttpSrv().get('/school/v1/teacher-transaction/transaction-revoked', { params: { teacher_id } });
